package org.jeecg.modules.kuner.userrec.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.kuner.userrec.entity.UserRecBase;
import org.jeecg.modules.system.entity.SysUser;

import java.util.Set;

/**
 * @Description: 会员推荐码信息
 * @Author: jeecg-boot
 * @Date: 2024-08-28
 * @Version: V1.0
 */
public interface UserRecBaseMapper extends BaseMapper<UserRecBase> {

    /**
     * 只查询推荐码set
     *
     * @return 查询到的系统中所有已存在的推荐码
     */
    @Select("select rec_code from user_rec_base")
    Set<String> selectAllRecCode();

    /**
     * 根据推荐码查询到会员信息
     *
     * @param recCode 推荐码
     * @return 查询到的会员信息
     */
    @Select("select su.* from sys_user su join user_rec_base mrb on su.id=mrb.user_id where mrb.rec_code=#{recCode}")
    SysUser selectUserByRecCode(String recCode);
}
